﻿<%@ Page Title="" Language="C#" MasterPageFile="~/HiredQnA.master" AutoEventWireup="true" CodeBehind="viewquestions.aspx.cs" Inherits="Hired.viewquestions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
    <style type="text/css">
        .gvQuestions
        {
            width: 90%;
            margin: 0 auto;
            padding: 2px;
            text-align: center;
            border-bottom: 1px solid #B8B58A;
        }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainPlaceHolder" runat="server">
        <span class="identifier">You are currently viewing questions in the
                    <asp:DropDownList ID="ddlCategory" runat="server" 
            AutoPostBack="True" onselectedindexchanged="ddlCategory_SelectedIndexChanged">
                        <asp:ListItem>General</asp:ListItem>
                        <asp:ListItem>Accounting</asp:ListItem>
                        <asp:ListItem>Administration</asp:ListItem>
                        <asp:ListItem>Arts, Media &amp; Communication</asp:ListItem>
                        <asp:ListItem>Computing</asp:ListItem>
                        <asp:ListItem>Construction</asp:ListItem>
                        <asp:ListItem>Education</asp:ListItem>
                        <asp:ListItem>Engineering</asp:ListItem>
                        <asp:ListItem>Healthcare</asp:ListItem>
                        <asp:ListItem>Hotels &amp; Restaurants</asp:ListItem>
                        <asp:ListItem>Manufacturing</asp:ListItem>
                        <asp:ListItem>Sales &amp; Marketing</asp:ListItem>
                        <asp:ListItem>Sciences</asp:ListItem>
                        <asp:ListItem>Services</asp:ListItem>
                    </asp:DropDownList>
                &nbsp;category.</span>
                <br /><span style="margin-left:25px;">Would you like to 
        <asp:LinkButton ID="lblAskQuestion" runat="server" 
            onclick="lblAskQuestion_Click"><strong>ask a question</strong></asp:LinkButton></span>?<br />
    <p>
        <asp:GridView ID="gvQuestions" runat="server" AutoGenerateColumns="False" 
            CssClass="gvQuestions" AllowPaging="True" AllowSorting="True" 
            CellPadding="10" GridLines="Horizontal">
            <AlternatingRowStyle BackColor="#CCCCFF" />
            <Columns>
                <asp:TemplateField HeaderText="Question title" ItemStyle-Width="65%">
                    <ItemTemplate>
                        <asp:LinkButton ID="lblTitle" runat="server"
                        Text='<%# Eval("Title") %>' PostBackUrl='<%# "question.aspx?id=" + Eval("QuestionID") %>'></asp:LinkButton>
                    </ItemTemplate>

<ItemStyle Width="65%"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Poster" ItemStyle-Width="15%">
                    <ItemTemplate>
                        <asp:LinkButton ID="lblUsername" runat="server"
                        Text='<%# Eval("Username") %>' PostBackUrl='<%# "viewprofile.aspx?username=" + Eval("Username") %>'></asp:LinkButton>
                    </ItemTemplate>

<ItemStyle Width="15%"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Last answer" ItemStyle-Width="20%">
                    <ItemTemplate>
                        <asp:Label ID="lblLastAnswer" runat="server" Text='<%# EvalLastAnswer(Eval("LastAnswer")) %>'></asp:Label>
                        <asp:LinkButton ID="lblLastPoster" runat="server" Text='<%# EvalLastPoster(Eval("LastPoster")) %>'
                        PostBackUrl='<%# "viewprofile.aspx?username=" + EvalLastPoster(Eval("LastPoster")) %>'></asp:LinkButton>
                    </ItemTemplate>

<ItemStyle Width="20%"></ItemStyle>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="#9933FF" ForeColor="White" HorizontalAlign="Center" />
            <PagerStyle BackColor="#9900FF" ForeColor="White" />
            <RowStyle BorderStyle="Outset" HorizontalAlign="Left" VerticalAlign="Middle" />
        </asp:GridView>
    </p>
</asp:Content>
